import request from '@/api/request.js'

// 左侧属性结构
export const getContentTree = (params) => {
    return request({
        url: `/channel/v_tree_Context?root=${params.root}&userId=${params.userId}`,
        method: 'GET'
    })
}

// 表格数据
export const getContentList = (params) => {
    return request({
        url: '/content/v_list.do',
        method: 'GET',
        params
    })
}

// 删除数据
export const deleteContent = (data, params) => {
    return request({
        url: 'content/deleteContentById',
        method: 'POST',
        params,
        data
    })
}

// 详情数据
export const contentDetail = (id) => {
    return request({
        url: `/content/getContentById?content_id=${id}`,
        method: 'GET'
    })
}

// 下载文件
export const downloadContent = (uuid) => {
    return request({
        url: `/content/downLoadFile?uuid=${uuid}`,
        method: 'GET',
        responseType: 'blob'
    })
}

// 获取标签
export const getTypeList = () => {
    return request({
        url: '/type/v_list',
        method: 'GET'
    })
}

// 添加标签
export const addType = (data) => {
    return request({
        url: `/type/v_add?name=${data.name}&disabled=${data.disabled}`,
        method: 'POST'
    })
}

// 修改标签状态
export const editType = (data) => {
    return request({
        url: `/type/v_edit?id=${data.id}&disabled=${data.disabled}`,
        method: 'PUT'
    })
}

// 删除标签
export const delType = (id) => {
    return request({
        url: `/type/o_delete?id=${id}`,
        method: 'DELETE'
    })
}

// 删除标签
export const submitContent = (params) => {
    return request({
        url: `/content/contentSubmit?content_id=${params.content_id}&user_id=${params.user_id}`,
        method: 'GET'
    })
}

// 审核通过
export const auditCheck = (params) => {
    return request({
        url: `/content/auditCheck?content_id=${params.content_id}&user_id=${params.user_id}`,
        method: 'GET'
    })
}

// 审核不通过
export const auditCheckFalse = (params) => {
    return request({
        url: `/content/auditCheckFalse?content_id=${params.content_id}&user_id=${params.user_id}&check_opinion=${params.check_opinion}`,
        method: 'GET'
    })
}

// 直接终审
export const directFinal = (params) => {
    return request({
        url: `/content/directFinal?content_id=${params.content_id}&user_id=${params.user_id}`,
        method: 'GET'
    })
}

// 校对
export const proofread = (params) => {
    return request({
        url: `/content/contentProofread?content_id=${params.content_id}&user_id=${params.user_id}`,
        method: 'GET'
    })
}

// 查看待审核数量
export const getPengding = (params) => {
    return request({
        url: '/content/selectPendingReview',
        method: 'GET',
        params
    })
}

// 获取可显示标签
export const gettypeListAble = () => {
    return request({
        url: '/type/listable',
        method: 'GET'
    })
}
